#pragma once
#include "Socket.hpp"

//三参数
int main(int argc,char*argv[])
{
    string serverip=argv[1];
    uint16_t port=stoi(argv[2]);
    Socket* conn=new TcpSocket();
    conn->BuildConnectSocketMethon(serverip,port);
    while(true)
    {
        string req;
        cout<<"你有什么想说的吗"<<endl;
        getline(std::cin,req);
        conn->Send(req);
            string buffer;

        while(true)
        {
            if(!conn->Recv(&buffer,1024))
            {
                break;
            }
            cout<<"对方："<<buffer<<endl;
            break;
        }
        if(buffer=="go out")
        {
            cout<<"我熄灭了"<<endl;
            break;
        }
    }
    conn->CloseSocket();
    return 0;
}